package testplan.services.mock;

import java.lang.reflect.Field;

import testplan.Log;
import testplan.entities.Agency;
import testplan.entities.User;
import testplan.services.UserService;

public class MockUserService implements UserService 
{

	public static final String DEV_AGENCY_NAME = "Developer Agency";
	public static final String DEV_AGENCY_CONTACT = "Kai & Shaoting";
	public static final long DEV_AGENCY_ID = 1001;
	public static final String DEV_USER_NAME = "Happy QA";
	public static final String DEV_USER_EMAIL = "happy_qa@hotmail.com";
	public static final long DEV_USER_ID = 2001;
	
	private Agency devAgency;
	private User devUser;
	
	public User getDevUser() 
	{
		if(devUser == null)
		{
			createDevUser();
		}
		return devUser;
	}
	
	public Agency getDevAgency()
	{
		if(devAgency == null)
		{
			createDevAgency();
		}
		return devAgency;
	}
	
	private void createDevUser()
	{
		devUser = new User(DEV_USER_NAME, DEV_USER_EMAIL, User.ROLE_PLAIN, DEV_AGENCY_ID);
		devUser.setKey(DEV_USER_ID);
		assert devUser.getKey() == DEV_USER_ID;
	}

	private void createDevAgency()
	{
		devAgency = new Agency(DEV_AGENCY_NAME, DEV_AGENCY_CONTACT);
		devAgency.setKey(DEV_AGENCY_ID);
		assert devAgency.getKey() == DEV_AGENCY_ID;
	}
}
